package geektime.spring.springbucks.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

@MappedSuperclass
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BaseEntity implements Serializable {

  private static final long serialVersionUID = -8002118415844845259L;

  @Id
  @GeneratedValue(strategy= GenerationType.IDENTITY)
  private Long id;
  @CreationTimestamp
  @Column(updatable = false)
  private Date createTime;
  @UpdateTimestamp
  private Date updateTime;
}
